const path = require('path');
const webpack = require('webpack');
const dllAssetPath = path.join(__dirname, 'dll');
const dllLibraryName = 'dllExample';

module.exports = {
  entry: {
    lodash: ['lodash'],
    moment: ['moment'],
    react: ['react'],
  },
  output: {
    path: dllAssetPath,
    filename: '[name].dll.js',
    library: dllLibraryName,
  },
  mode: 'production',
  plugins: [
    new webpack.DllPlugin({
      name: dllLibraryName,
      path: path.join(dllAssetPath, '[name].manifest.json'),
    }),
    // 解决数字 id 的问题
    new webpack.ids.HashedModuleIdsPlugin(),
  ],
};
